package work20240725;

import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class stream5 {
    public static void main(String[] args) {
        hashArrs();
    }
    public static void hashArrs() {
        int[] a1 = new int[]{1,2,3};
        int[] a2 = new int[]{3,4,5,2};
        Map<Integer,Integer> hashArr = Stream.concat(Arrays.stream(a1).boxed(),Arrays.stream(a2).boxed())
                .collect(Collectors.toMap(
                        num -> num,
                        num -> 1,
                        Integer :: sum
                ));
        List<Integer> arr = hashArr.entrySet().stream()
                .filter(p -> p.getValue() == 1)
                .map(Map.Entry::getKey)
                .collect(Collectors.toList());
        System.out.println(arr);
    }
}
